<template>
  <!-- 放置一个图标 -->
  <div>
    <!-- svg-icon组件, 配置icon-class属性, 配置成svg的文件名即可 -->
    <svg-icon
      v-if="!isFullScreen"
      icon-class="fullscreen"
      class="fullscreen"
      @click="toggleFullScreen"
    />
    <svg-icon
      v-else
      icon-class="exit-fullscreen"
      class="fullscreen"
      @click="toggleFullScreen"
    />
  </div>
</template>
<script>
import ScreenFull from 'screenfull'
export default {
  name: 'ScreenFull',

  data() {
    return {
      isFullScreen: false, // 控制全屏缩放 默认false
    }
  },

  mounted() {},

  methods: {
    toggleFullScreen() {
      if (!ScreenFull.isEnabled) {
        this.$message.error('你的浏览器不太行！')
      }
      ScreenFull.toggle()
      this.isFullScreen = !this.isFullScreen
    },
  },
}
</script>

<style scoped>
</style>